Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: support pattern as pipeline key name #4368

Merged
merged 3 commits into from
Jul 18, 2024

Conversation

shuiyisong
Copy link
Contributor

@shuiyisong shuiyisong commented Jul 15, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

This pr mainly

  • supports pattern as field key name in pipeline yaml along with patterns
  • adds some tests

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.

Summary by CodeRabbit

  • New Features

    • Introduced new methods for parsing and handling patterns in the ETL processor, enhancing its ability to dissect and process data fields.
  • Tests

    • Added new test cases for pattern processing, including dissecting patterns and regex pattern application.
    • Simplified the creation of expected schemas in test cases by introducing a common function for schema construction, improving code reusability and maintainability.

Copy link
Contributor

coderabbitai bot commented Jul 15, 2024

Walkthrough

The updates make significant refinements to the ETL pipeline in the project. Primarily, the changes involve enhancing pattern processing capabilities for dissecting and regex functionalities, introducing new methods and constants, and improving test coverage to ensure the correctness of these features. Additionally, test files were refactored to use a common function for column schema creation, promoting code reusability and simplifying the codebase.

Changes

Files Change Summary
src/pipeline/src/etl/processor/dissect.rs Added yaml_parse_string function and PATTERN_NAME constant to handle YAML pattern parsing.
src/pipeline/src/etl/processor/regex.rs Added PATTERN_NAME constant, try_with_patterns method, and test_simple_parse function for regex processing.
src/pipeline/tests/common.rs Added SemanticType to imports, modified make_column_schema function to include semantic type.
src/pipeline/tests/dissect.rs Introduced tests for dissecting patterns, parsing input values, and validating output schema and values.
src/pipeline/tests/gsub.rs, join.rs, on_failure.rs Refactored to use common::make_column_schema for schema creation, promoting reusability and simplifying code.
src/pipeline/tests/regex.rs Introduced tests for regex pattern processing, validating extracted data fields, and verifying output schema.

Poem

In code, where patterns weave and wind,
New methods now do ease the mind.
Tests abound, schemas align,
Refactored paths make code refined.
🌟 With regex true and YAML parsed,
Pipeline flows, the magic sparked.
~ A rabbit's joy in code, unmasked. ~ 🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Jul 15, 2024
@shuiyisong shuiyisong changed the title chore: support pattern as pipeline key name with patterns chore: support pattern as pipeline key name Jul 15, 2024
@shuiyisong shuiyisong requested a review from paomian July 15, 2024 07:53
@shuiyisong shuiyisong marked this pull request as ready for review July 15, 2024 07:53
@shuiyisong shuiyisong requested a review from a team as a code owner July 15, 2024 07:53
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b8bd845 and ea89866.

Files selected for processing (8)
  • src/pipeline/src/etl/processor/dissect.rs (2 hunks)
  • src/pipeline/src/etl/processor/regex.rs (3 hunks)
  • src/pipeline/tests/common.rs (2 hunks)
  • src/pipeline/tests/dissect.rs (1 hunks)
  • src/pipeline/tests/gsub.rs (2 hunks)
  • src/pipeline/tests/join.rs (1 hunks)
  • src/pipeline/tests/on_failure.rs (5 hunks)
  • src/pipeline/tests/regex.rs (1 hunks)
Additional comments not posted (13)
src/pipeline/tests/gsub.rs (1)

16-16: LGTM!

The changes improve code reuse by using the make_column_schema function from the common module.

src/pipeline/tests/common.rs (1)

15-15: LGTM!

The addition of the SemanticType parameter to the make_column_schema function enhances the accuracy of the test schema.

src/pipeline/tests/join.rs (1)

35-44: LGTM!

The changes improve code reuse by using the make_column_schema function from the common module.

src/pipeline/tests/regex.rs (1)

1-109: LGTM!

The changes improve code reuse by using the make_column_schema function from the common module.

src/pipeline/tests/dissect.rs (2)

20-65: LGTM!

The test function test_dissect_pattern is well-structured and validates the functionality as expected.


67-113: LGTM!

The test function test_dissect_patterns is well-structured and validates the functionality as expected.

src/pipeline/tests/on_failure.rs (4)

Line range hint 16-48: LGTM!

The test function test_on_failure_with_ignore is well-structured and validates the functionality as expected.


Line range hint 49-93: LGTM!

The test function test_on_failure_with_default is well-structured and validates the functionality as expected.


Line range hint 94-129: LGTM!

The test function test_default is well-structured and validates the functionality as expected.


Line range hint 130-181: LGTM!

The test function test_multiple_on_failure is well-structured and validates the functionality as expected.

src/pipeline/src/etl/processor/regex.rs (2)

160-162: LGTM!

The method try_with_patterns is well-structured and handles errors appropriately.


216-243: LGTM!

The test function test_simple_parse is well-structured and validates the functionality as expected.

src/pipeline/src/etl/processor/dissect.rs (1)

562-565: LGTM!

The method try_from for DissectProcessor is well-structured and handles errors appropriately.

Copy link

codecov bot commented Jul 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.87%. Comparing base (67dfdd6) to head (ea89866).
Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4368      +/-   ##
==========================================
- Coverage   85.21%   84.87%   -0.34%     
==========================================
  Files        1060     1063       +3     
  Lines      189484   190148     +664     
==========================================
- Hits       161474   161395      -79     
- Misses      28010    28753     +743     

@evenyag evenyag added this pull request to the merge queue Jul 18, 2024
Merged via the queue into GreptimeTeam:main with commit 8ab6136 Jul 18, 2024
56 of 70 checks passed
@shuiyisong shuiyisong deleted the chore/fix_pattern_compatibility branch August 13, 2024 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants